#ifndef SHORTCUTSMODEL_H
#define SHORTCUTSMODEL_H

#include <QObject>
#include <QVariant>
#include <QAbstractTableModel>
#include <QModelIndex>
#include <map>
#include <QKeySequence>
#include <QString>

#include "mucustomshortcuts.h"

class ShortcutsModel : public QAbstractTableModel
{
		Q_OBJECT
	public:

		enum ModelColumns
		{
			NameColumn,
			ShortcutColumn
		};


	private:

		typedef std::map<QString, QKeySequence> TransientDataStorage;

	public:

		explicit ShortcutsModel(QObject *parent = 0);

		//presentation minimum
		QModelIndex parent(const QModelIndex &child) const;
		QVariant data(const QModelIndex &index, int role) const;
		int rowCount(const QModelIndex &parent) const;
		int columnCount(const QModelIndex &parent) const;

		QVariant headerData(int section, Qt::Orientation orientation, int role) const;

		//editalbe minimum
		Qt::ItemFlags flags(const QModelIndex &index) const;
		bool setData(const QModelIndex &index, const QVariant &value, int role);

		void applyChanges();

	signals:

	public slots:

		void setShortcuts(MuCustomShortcuts*);

	private:

		QVariant displayRoleData(const QModelIndex& index) const;
		QVariant editRoleData(const QModelIndex& index) const;
		QVariant textAlignmentData(const QModelIndex& index) const;

	private:

		MuCustomShortcuts* _shortcuts;
		TransientDataStorage _transientData;

};

#endif // SHORTCUTSMODEL_H
